package com.michael.study.jetpack.module.databinding

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import com.michael.study.jetpack.R
import com.michael.study.jetpack.databinding.ActivityDataBindingBinding
import com.michael.study.jetpack.utils.Actions

class DataBindingActivity : AppCompatActivity(), View.OnClickListener {

    private lateinit var mBinding:ActivityDataBindingBinding


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mBinding = ActivityDataBindingBinding.inflate(layoutInflater)
        setContentView(mBinding.root)
        mBinding.btnNormal.setOnClickListener(this)
        mBinding.btnViewModel.setOnClickListener(this)
    }

    override fun onClick(v: View?) {
        when(v?.id) {
            R.id.btn_normal -> {
                Actions.startActivity(this,NormalActivity::class.java)
            }
            R.id.btn_view_model -> {
                Actions.startActivity(this,ViewModelActivity::class.java)
            }
        }
    }
}